package com.ss.android.article.common.share.helper;

import android.content.Context;

import com.ss.android.account.Spipe;
import com.ss.android.article.common.share.abs.AbsShareHelper;
import com.ss.android.article.common.share.interf.IShareArticleBean;
import com.ss.android.article.common.share.interf.IShareDataBean;
import com.ss.android.article.common.share.interf.IShareEntryItemBean;
import com.ss.android.article.common.share.interf.IShareEssayBean;
import com.ss.android.article.share.entity.ShareAction;

public final class CommonSystemShareHelper extends AbsShareHelper {
    private Context f;

    public CommonSystemShareHelper(Context arg1) {

        this.f = arg1;
    }

    public final boolean a(IShareDataBean arg13) {
        Object[] v7_1;
        String v5;
        String v3;
        String v0;
        String v6;
        String v4 = null;
        int v11 = 3;
        int v10 = 2;
        boolean v2 = false;
        if(this.f != null && arg13 != null) {
            if((arg13 instanceof IShareEntryItemBean)) {
                v6 = this.f.getString(com.ss.android.article.browser.R.string.app_name);
                Context v7 = this.f;
                if(arg13 == null) {
                    v0 = "";
                }
                else {
                    int v0_1 = Spipe.inst().pgcMediaid == ((IShareEntryItemBean)arg13).getId() ? 1 : 0;
                    v3 = ((IShareEntryItemBean)arg13).getName() != null ? ((IShareEntryItemBean)arg13).getName() : "";
                    v4 = ((IShareEntryItemBean)arg13).getDescription() != null ? ((IShareEntryItemBean)arg13).getDescription() : "";
                    v5 = ((IShareEntryItemBean)arg13).getShareUrl() != null ? ((IShareEntryItemBean)arg13).getShareUrl() : "";
                    v0 = v0_1 != 0 ? v7.getString(com.ss.android.article.browser.R.string.s5) : v7.getString(com.ss.android.article.browser.R.string.s6);
                    v7_1 = new Object[v11];
                    v7_1[0] = v3;
                    v7_1[1] = v4;
                    v7_1[v10] = v5;
                    v0 = String.format(v0, v7_1);
                }

                v2 = this.share(v6, v0);
            }
            else {
                if((arg13 instanceof IShareArticleBean)) {
                    if(this.f == null) {
                        return v2;
                    }

                    if(android.support.design.a.isTextEmpty(((IShareArticleBean)arg13).getTitle())) {
                        return v2;
                    }

                    v0 = ((IShareArticleBean)arg13).a("android_share", v4);
                    v3 = this.f.getString(com.ss.android.article.browser.R.string.system_share_fmt);
                    Object[] v4_1 = new Object[v11];
                    v4_1[0] = ((IShareArticleBean)arg13).getTitle();
                    v4_1[1] = v0;
                    v4_1[v10] = this.f.getString(com.ss.android.article.browser.R.string.ds);
                    return this.share(String.format(this.f.getString(com.ss.android.article.browser.R.string.vf), ((IShareArticleBean)arg13).getTitle()), String.format(v3, v4_1));
                }

                if(!(arg13 instanceof IShareEssayBean)) {
                    return v2;
                }

                if(android.support.design.a.isTextEmpty(((IShareEssayBean)arg13).d())) {
                    return v2;
                }

                Context v5_1 = this.f;
                if(arg13 == null) {
                    v0 = v4;
                }
                else {
                    v0 = ((IShareEssayBean)arg13).d();
                    if(v0 == null) {
                        v0 = "";
                    }

                    v3 = "";
                    if(((IShareEssayBean)arg13).b() != null) {
                        v3 = v5_1.getString(com.ss.android.article.browser.R.string.ve);
                    }

                    v6 = ((IShareEssayBean)arg13).f();
                    v5 = v5_1.getString(com.ss.android.article.browser.R.string.detail_share);
                    v7_1 = new Object[v11];
                    v7_1[0] = v0;
                    v7_1[1] = v3;
                    v7_1[v10] = v6;
                    v0 = String.format(v5, v7_1);
                }

                v2 = this.share(v4, v0);
            }
        }

        return v2;
    }

    private boolean share(String arg3, String arg4) {
        return new com.ss.android.article.share.d.e(this.f).a(ShareAction.link).b(arg4).a(arg3).a();
    }

    public final boolean doAction(Object arg2, Object[] arg3) {
        return this.a(((IShareDataBean)arg2));
    }
}

